package com.sky.merchant.controller;

import com.sky.common.annotation.Anonymous;
import com.sky.common.core.domain.AjaxResult;
import com.sky.merchant.exception.CustomException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Anonymous
@RestController
@RequestMapping("/exception")
public class ExceptionController {

    @GetMapping("/throw-custom")
    public AjaxResult throwCustomException() {
        throw new CustomException(401,"This is a custom exception");
    }

    @GetMapping("/throw-other")
    public AjaxResult throwOtherException() {
        throw new RuntimeException("This is a runtime exception");
    }
}